Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
permutation-rank
Advanced tools
Ranks and unranks permutations. Based on the following paper:
W. Myrvold, F. Ruskey. (2000) "Ranking and Unranking Permutations in Linear Time". Information Processing Letters.
First install using npm:
npm install permutation-rank
Then you can use it like this:
var prank = require("permutation-rank")
var perm = [0,3,1,2]
var r = prank.rank(perm)
console.log("r = ", r)
var u = prank.unrank(perm.length, r)
console.log("u = ", u)
//Prints:
// r = 15
// u = [ 0, 3, 1, 2 ]
prank.rank(permutation)
Computes an integer representing the colexicographic rank of the permutation
permutation
is an array encoding some permutationReturns An integer representing the ranked encoding of the permutation
prank.unrank(length, rank[, result])
Computes a permutation from a rank order with the given length
length
is the length of the permuationrank
is the index of the permutationresult
is an optional argument which stores the result of the inversionReturns The permutation at the given rank
(c) 2013 Mikola Lysenko. MIT License
FAQs
Ranks and unranks permutations
The npm package permutation-rank receives a total of 15,400 weekly downloads. As such, permutation-rank popularity was classified as popular.
We found that permutation-rank demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.